import { handleActions } from "redux-actions";
import Immutable from "seamless-immutable";
import * as type from "../types/kms";
export const defaultState = Immutable({
  guideStep: 0,
  guideStepMaxLen: -1,
  guideContent: null,

  listUse: {}
});

export default handleActions(
  {
    [type.KMS_SET_SETP]: (state, action: any) =>
      state.set("guideStep", action.result),
    [type.KMS_SET_SETP_MAX_LEN]: (state, action: any) =>
      state.set("guideStepMaxLen", action.result),
    [type.KMS_SET_CONTENT]: (state, action: any) =>
      state.set("guideContent", action.result),

    [type.KMS_SET_LIST_USE_SUCCESS]: (state, { payload }) =>
      state.merge({ listUse: payload }, { deep: true })
  },
  defaultState
);
